package org.cvcsc.weproject.controller.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;

import org.cvcsc.weproject.domain.AttendState;
import org.cvcsc.weproject.domain.Attendance;

@Schema(description = "考勤信息响应对象")
public class ResponseDtoAttendance {
    @Schema(description = "考勤ID", example = "123")
    private Long id;
    @Schema(description = "课程安排ID", example = "456")
    private Long courseScheduleId;
    @Schema(description = "学生ID", example = "789")
    private Long studentId;
    @Schema(description = "出勤状态", example = "PRESENT")
    private String status;
    @Schema(description = "考勤时间", example = "2023-01-01T12:00:00")
    private LocalDateTime attendanceTime;

    private AttendState state;

    @Schema(description = "课程名称", example = "Java编程")
    private String courseScheduleName;

    @Schema(description = "课程周数", example = "1")
    private int week;

    @Schema(description = "班级ID", example = "101")
    private Long clazzId;

    @Schema(description = "班级名称", example = "计算机科学1班")
    private String clazzName;

    @Schema(description = "上课日", example = "1")
    private int day;

    @Schema(description = "结束节次", example = "3")
    private int endPeriod;

    @Schema(description = "开始节次", example = "1")
    private int startPeriod;

    // Getters and Setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCourseScheduleId() {
        return courseScheduleId;
    }

    public void setCourseScheduleId(Long courseScheduleId) {
        this.courseScheduleId = courseScheduleId;
    }

    public Long getStudentId() {
        return studentId;
    }

    public void setStudentId(Long studentId) {
        this.studentId = studentId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public LocalDateTime getAttendanceTime() {
        return attendanceTime;
    }

    public void setAttendanceTime(LocalDateTime attendanceTime) {
        this.attendanceTime = attendanceTime;
    }

    public void setCourseScheduleName(String courseScheduleName) {
        this.courseScheduleName = courseScheduleName;
    }

    public void setWeek(int week) {
        this.week = week;
    }

    public void setClazzId(Long clazzId) {
        this.clazzId = clazzId;
    }

    public void setClazzName(String clazzName) {
        this.clazzName = clazzName;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public void setEndPeriod(int endPeriod) {
        this.endPeriod = endPeriod;
    }

    public void setStartPeriod(int startPeriod) {
        this.startPeriod = startPeriod;
    }

    // Getter 和 Setter
    public AttendState getState() {
        return state;
    }

    public void setState(AttendState state) {
        this.state = state;
    }

    public ResponseDtoAttendance(Attendance attendance) {
        this.setId(attendance.getId());
        this.state = attendance.getState();
        this.setCourseScheduleId(attendance.getCourseSchedule().getId());
        this.setCourseScheduleName(attendance.getCourseSchedule().getCourseName());
        this.setWeek(attendance.getCourseSchedule().getCourseScheduleTime().getWeek());
        this.setClazzId(attendance.getCourseSchedule().getClazz().getId());
        this.setClazzName(attendance.getCourseSchedule().getClazz().getName());
        this.setDay(attendance.getCourseSchedule().getCourseScheduleTime().getDay());
        this.setEndPeriod(attendance.getCourseSchedule().getCourseScheduleTime().getEndPeriod());
        this.setStartPeriod(attendance.getCourseSchedule().getCourseScheduleTime().getStartPeriod());
    }

}